<template>
	<view class="" v-if="pageShow">
		<view class="" style="padding-bottom: 130rpx;">
			<u-swiper :list="dataAll.images_text" radius="0" circular height="350"></u-swiper>
			<view class="mainpadding">
				<view class="sishi fonweight xiaohei">{{dataAll.name}}</view>
				<text class="sishi flexright xiaohong fonweight margin_top">￥{{dataAll.price}}</text>
				<view class="ffffff mainpadding radius margin_top">
					<view class="xiaohui sanshier nofonweight">库号：{{dataAll.kh}}</view>
					<view class="margin_top2 flexbetween">
						<view class="xiaohui sanshier nofonweight ">作者: {{dataAll.auther}}</view>
						<view class="xiaohui sanshier nofonweight ">规格: {{dataAll.sku}}</view>
					</view>
					<view class="xiaohui margin_top2 sanshier nofonweight">制作材料: {{dataAll.zzcl}}</view>
					<view class="xiaohui margin_top2 sanshier nofonweight">上牌日期: {{dataAll.sp_time_text}}</view>
				</view>
				<view class="margin_top">
					<view class="flexcenter">
						<view class="hengxian margin_right2"></view>
						<text class="sanshier xiaohei fonweight margin_right2">作品介绍</text>
						<view class="hengxian"></view>
					</view>
					<view class="margin_top">
						<u-parse :content="dataAll.content"></u-parse>
					</view>
				</view>
			</view>
		</view>
		<view class="gudingdb ffffff mainpadding">
			<view class="bigbtn" @click="submit">抢购</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				pageShow: false,
				listid: "",
				cc_id: "",
				dataAll: {}
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.cc_id = options.cc_id
			this.getDetail()
		},
		methods: {
			getDetail() {
				httpRequest.request("/api/cccl/ccGoodsDetail", 'GET', {
					goods_id: this.listid,
					cc_id: this.cc_id,
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.dataAll = res.data
						this.pageShow = true
					}else{
						httpRequest.toast(res.msg)
						setTimeout(()=>{
							uni.navigateBack(1)
						},1000)
					}
				})
			},
			submit() {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				httpRequest.modal('提示', '确认抢购？', true, (res) => {
					if (res) {
						httpRequest.request('/api/cccl/nowBuy', 'POST', {
							goods_id: this.listid,
							cc_id: this.cc_id,
						}).then(res => {
							httpRequest.toast(res.msg)
							if(res.code==-1){
								uni.navigateTo({
									url:"/pages/mypage/shimingrenz"
								})
							}
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.hengxian {
		width: 176rpx;
		height: 1rpx;
		background: #DDDDDD;
	}
</style>